#!/bin/bash

if [ "$1" == "" ]; then
    echo "Usage: $0 <path>"
    echo ""
    echo "Replaces Eigen by Eigen3 recursively in all files in <path>."
    exit 1
fi

for f in $(grep -lr 'namespace Eigen\|Eigen::\|Eigen/' $1 | grep -v '.svn'); do
    echo "Processing $f"
    sed -i -e 's/namespace Eigen/namespace Eigen3/g' $f
    sed -i -e 's/Eigen::/Eigen3::/g' $f
    sed -i -e 's/Eigen\//Eigen3\//g' $f
done
